package bishi;

import java.util.Scanner;
import java.util.logging.Logger;

/**
 * @Author liuhaoqi
 * @Date 2020/8/28 17:36
 * @Version 1.0
 */
public class Jingdong01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s = String.valueOf(n);
        char[] chars = s.toCharArray();
        long ans = 0;
        int bit = 1;
        for (int i = 0; i < chars.length; i++) {
            long temp = Long.parseLong(String.valueOf(chars[i]));
            ans += temp * bit;
            bit = bit * 10;
        }
//        System.out.println(ans);
        long reminder = 0;
        long result = 0;
        bit = 1;
        while (ans >= 5) {
            reminder = ans % 5;
            ans = ans / 5;
            result += bit * reminder;
            bit *= 10;
        }
        System.out.println(result);

    }
}
